Skip to content

ci: add uv lock --check to catch stale lockfiles - #1081

Merged
mangelajo merged 1 commit into
mainfrom
ci/uv-lock-check
Sep 10, 2026
Merged

ci: add uv lock --check to catch stale lockfiles#1081
mangelajo merged 1 commit into
mainfrom
ci/uv-lock-check

Conversation

@mangelajo

Copy link
Copy Markdown
Member

Problem

When uv.lock is regenerated locally with a different Python version than CI uses (e.g., local Python 3.13 via .python-version vs CI Python 3.14), package resolutions can differ. This leads to packages like Pillow resolving to older versions that lack cp314 wheels, causing CI test failures with cryptic install errors.

This happened on #1068 — after a rebase, uv lock was run locally with Python 3.13, which resolved Pillow to 11.2.1 (no cp314 wheels) instead of 12.3.0 (has cp314 wheels), breaking the Python 3.14 CI job.

Fix

Add a uv lock --check step before Run pytest in the CI workflow. This command verifies that the lockfile is consistent with the current pyproject.toml and Python version without modifying it. If the lockfile is stale or was generated with a different Python, the step fails early with a clear error message instead of proceeding to cryptic wheel installation failures.

Notes

  • uv lock --check is a read-only operation — it never modifies the lockfile
  • This runs on every test matrix combination (all Python versions × all runners), so it will catch version-specific resolution mismatches
  • The .python-version file is already in .gitignore, so this is the safety net for developers who have local overrides

When uv.lock is regenerated with a different Python version than CI
uses (e.g., local 3.13 vs CI 3.14), package resolutions can differ,
leading to missing wheels at test time. Adding 'uv lock --check'
before pytest catches this early with a clear error message instead
of cryptic install failures.
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fb291faf-c545-4f56-a1d6-747382404d04

📥 Commits

Reviewing files that changed from the base of the PR and between 5dcf57d and 6e236df.

📒 Files selected for processing (1)
  • .github/workflows/python-tests.yaml

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The Python test workflow adds a uv lock --check step in the pytest-matrix job. The step runs from the python directory and verifies that uv.lock matches the project dependencies.

Changes

Dependency Validation

Layer / File(s) Summary
Lockfile consistency check
.github/workflows/python-tests.yaml
The pytest-matrix job checks that uv.lock is up-to-date before running the Python test matrix.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 6e236

The Python test matrix now detects stale dependency lockfiles before running tests. The change is ready to merge with no identified current risk.

Suggested reviewers: raballew

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the stale-lockfile problem and the uv lock --check CI fix. It directly matches the changeset and objectives.
Title check ✅ Passed The title clearly and concisely describes the main change: adding uv lock --check to CI to detect stale lockfiles.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/uv-lock-check

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the lockfile bright
Before the tests begin their flight
uv hops through dependencies
Keeping versions in harmony
Green checks dance across the screen

Comment @coderabbitai help to get the list of available commands.

@mangelajo
mangelajo added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit f602043 Sep 10, 2026
25 checks passed
@mangelajo
mangelajo deleted the ci/uv-lock-check branch September 10, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants